package com.cloud.order.controller;

import com.cloud.common.base.ApiResponse;
import com.cloud.order.mapper.entity.Orders;
import com.cloud.order.service.IOrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: Dream_xun
 * @date: 2021-01-17 18:25
 * @description:
 */

@Api(tags = "订单Controller")
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrdersService ordersService;

    @ApiOperation("测试方法")
    @GetMapping("/test")
    public ApiResponse<String> test(){
        return ApiResponse.respond("测试成功");
    }

    @ApiOperation("创建订单")
    @PostMapping("/createOrder")
    public ApiResponse createOrder(@RequestBody Orders order){
        return ApiResponse.respond(ordersService.createOrder(order));
    }
}
